home *** CD-ROM | disk | FTP | other *** search
/ Aminet 30 / Aminet 30 (1999)(Schatztruhe)[!][Apr 1999].iso / Aminet / gfx / edit / VE-addspaceb.lha / arexx / AddSpaceB.rexx
OS/2 REXX Batch file  |  1999-01-15  |  3KB  |  156 lines

  1. /*
  2.  
  3.    v1.00 AddSpace B
  4.  
  5.    Marko Seppänen
  6.    marko.seppanen@wwnet.fi
  7.  
  8. */
  9.  
  10.  
  11. address IMAGEENGINEER
  12.  
  13. Options results
  14. signal on error            /* Setup a place for errors to go */
  15.  
  16.  
  17. if arg()=0 then exit
  18. x=arg(1)
  19. pic=subword(x,1,1)
  20. value=subword(x,2,1)
  21. bg=subword(x,3,1)
  22. if bg=BLACK then bg=1
  23. if bg=WHITE then bg=0
  24. if bg=GUESS then bg=2
  25.  
  26.  
  27. MARK pic PRIMARY
  28. PROJECT_INFO pic WIDTH
  29. picwidth=result
  30. PROJECT_INFO pic HEIGHT
  31. picheight=result
  32. PROJECT_INFO pic ZOOM
  33. origzoomval=result
  34.  
  35.  
  36. if bg="" then do
  37.  
  38.   if exists("ie:prefs/veaddspaceb.cfg") == "1" then
  39.     do
  40.       call open("temp","ie:prefs/veaddspaceb.cfg","R")
  41.       values=readln("temp")
  42.       parse var values ok bg side value .
  43.       call close("temp")
  44.     end
  45.   else
  46.     do
  47.       bg=0
  48.       side=0
  49.       value=100
  50.     end
  51.  
  52.   'FORM "Add Space B" "Use|Cancel"',
  53.   'CYCLE,"Background color","White|Black|Guess",'bg'',
  54.   'CYCLE,"Sides","Right & Bottom|Bottom & Left|Left & Top|Top & Right",'side'',
  55.   'INTEGER,"Space to add",1,1000,'value',SLIDER'
  56.  
  57.   values=result
  58.   parse var values ok bg side value .
  59.  
  60.   if ok = 0 then exit
  61.  
  62.   call open("temp","ie:prefs/veaddspaceb.cfg","W")
  63.   res=writeln("temp",values)
  64.   call close("temp")
  65.  
  66. end
  67.  
  68.  
  69.  
  70. if side=="0" then
  71.  
  72.   do
  73.     offsetx=0
  74.     offsety=0
  75.   end
  76.  
  77. if side=="1" then
  78.  
  79.   do
  80.     offsetx=value
  81.     offsety=0
  82.   end
  83.  
  84. if side=="2" then
  85.  
  86.   do
  87.     offsetx=value
  88.     offsety=value
  89.   end
  90.  
  91. if side=="3" then
  92.  
  93.   do
  94.     offsetx=0
  95.     offsety=value
  96.   end
  97.  
  98.  
  99.  
  100. if bg == 0 then do
  101.     BRIGHTNESS pic 255
  102.     bgcolor=result
  103.     RESIZE bgcolor picwidth+value picheight+value TILE
  104.     bgcolor2=result
  105.     CLOSE bgcolor
  106.     MARK bgcolor2 SECONDARY
  107.     COMPOSITE offsetx offsety MIN
  108.     pic2=result
  109. end
  110. if bg == 1 then do
  111.     BRIGHTNESS pic "-255"
  112.     bgcolor=result
  113.     RESIZE bgcolor picwidth+value picheight+value TILE
  114.     bgcolor2=result
  115.     CLOSE bgcolor
  116.     MARK bgcolor2 SECONDARY
  117.     COMPOSITE offsetx offsety MAX
  118.     pic2=result
  119. end
  120. if bg == 2 then do
  121.     CROP pic picwidth-1 picheight-1 picwidth-1 picheight-1
  122.     bgpixel=result
  123.     RESIZE bgpixel picwidth+value picheight+value TILE
  124.     bgcolor2=result
  125.     CLOSE bgpixel
  126.     MARK bgcolor2 SECONDARY
  127.     COMPOSITE offsetx offsety MIX 100
  128.     pic2=result
  129. end
  130.  
  131. CLOSE bgcolor2
  132.  
  133.  
  134. PROJECT_SET pic2 ZOOM origzoomval
  135.  
  136.  
  137. exit
  138.  
  139. /*******************************************************************/
  140. /* This is where control goes when an error code is returned by IE */
  141. /* It puts up a message saying what happened and on which line     */
  142. /*******************************************************************/
  143. error:
  144. if RC=5 then do            /* Did the user just cancel us? */
  145.     IE_TO_FRONT
  146.     LAST_ERROR
  147.     'REQUEST "'||RESULT||'"'
  148.     exit
  149. end
  150. else do
  151.     IE_TO_FRONT
  152.     LAST_ERROR
  153.     'REQUEST "Error detected!!!'||D2C(10)||'Image Engineer error message is as follows'||D2C(10)||result||D2C(10)||'Script failed on line '||SIGL||'"' 'Doh!'
  154.     exit
  155. end
  156.